package com.fc.mall.portal.controller;

import com.fc.mall.base.object.Result;
import com.fc.mall.portal.service.PromoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/promote")
@Api(tags = "PromoteController", description = "推广接口")
public class PromoteController {

    @Autowired
    private PromoteService promoteService;

    @ApiOperation("获取推广分享照片")
    @RequestMapping(value = "/product/{productId}", method = RequestMethod.GET)
    @ResponseBody
    public Object getInfo(@PathVariable Long productId, @RequestParam Long orderGroupId) {
        return promoteService.generateProductPromoteImage(productId, orderGroupId);
    }

    @ApiOperation("生成个人分享海报")
    @PostMapping("/member/poster")
    public Result generatePersonalPoster()
    {
        return promoteService.generatePersonalPoster();
    }

    @ApiOperation("生成砍价分享海报")
    @PostMapping("bargain/{bargainId}")
    public Result generateBargainPoster(@PathVariable Long bargainId) {
        return promoteService.generateBargainPoster(bargainId);
    }
}
